

const SERVER_LIST = [
  {
    id: 'prod',
    name: '生产环境',
    host: '192.168.66.128',
    port: 22,
    username: 'root',
    password: '1655658911',
    path: '/home/nginx/html/', //部署路径
    readyTimeout: 5000,
    command: 'cp -r /home/nginx/html  /home/nginx/html/backups/dickie_vue' + getFormatDate() + '\nrm -rf /home/nginx/html/*'
  },
  {
    id: 'test',
    name: '测试环境',
    host: '',
    port: 22,
    username: 'root',
    password: '',
    path: '/home/nginx/html/gas_vue/',
    readyTimeout: 5000,
    command: 'cp -r /home/nginx/html/gas_vue  /home/nginx/html/backups/gas_vue' + getFormatDate() + '\nrm -rf /home/nginx/html/gas_vue/*'
  },
];




function getFormatDate() {
  let date = new Date();
  let myyear = date.getFullYear();
  let mymonth = date.getMonth() + 1;
  let myweekday = date.getDate();

  if (mymonth < 10) {
    mymonth = '0' + mymonth;
  }
  if (myweekday < 10) {
    myweekday = '0' + myweekday;
  }
  return (myyear + '' + mymonth + '' + myweekday);
}




const getServer = () => {
  return SERVER_LIST.find(item => {
    return item.id === process.env.NODE_ENV
  })
}


module.exports = getServer();
